package com.at.lmm.provider;

import com.at.lmm.entiy.UserInfo;
import com.at.lmm.provider.service.UserServiceImpl;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.cloud.context.config.annotation.RefreshScope;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;

@RefreshScope
@RestController // 热加载 @Value("${file.name}") 配置
public class Controller {
    @Value("${file.name}")
    private String fileName;

    @GetMapping("/file")
    public String getFileName(){
        return fileName;
    }

    @GetMapping("/UserInfo/{userId}")
    public UserInfo getUserInfo(@PathVariable("userId") Long userId){
        UserServiceImpl userService = new UserServiceImpl();
        return userService.getUserById(userId);
    }
}
